package com.oig.sys.log.feign;


import com.oig.sys.log.dto.SysLogDto;
import com.oig.sys.log.feign.factory.SysLogFallBackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * 因为@EnableFeignClient注解basePackages配置，默认不扫描子包，
 * factory和fallback包@Component都无效， 导致降级配置后无法启动
 * fallback可以不扫描，先把factory里的类直接放到spring.factories里去
 * 启动类@SpringBootApplication的basePackages包含这类包可能是更好的方式
 */
@FeignClient(contextId = "sysLogService", value = "sys-log-server", path = "/syslog", fallbackFactory = SysLogFallBackFactory.class)
public interface SysLogService {

    @PostMapping(value = "/addSysLog")
    void addSysLog(@RequestBody SysLogDto logDto, @RequestHeader("Authorization") String token);

}
